package org.siam.utils {

	import flexunit.framework.Assert;
	import flexunit.framework.TestCase;
	
	public class ClassUtilsTest extends TestCase {
		
		public function testResolveName():void {
			// Inexisting Reference or internal class
			// Note all constructors are public in as3, no need to test
			try {
				ClassUtils.resolveName("missing.class");
				Assert.fail("A missing reference should throw a ReferenceError");
			} catch (e:ReferenceError) {
				// Error #1065: Variable ClassInternalFixture is not defined.
			}
			// Null argument
			try {
				ClassUtils.resolveName(null);
				Assert.fail("A null argument should throw a ?");
			} catch (e:ArgumentError) {
				// Error #1507: Argument name cannot be null.
			}
			
			// Existing and accessible classes
			Assert.assertEquals(Assert, ClassUtils.resolveName("flexunit.framework.Assert"));
			Assert.assertEquals(Assert, ClassUtils.resolveName("flexunit.framework::Assert"));
			
			// Built-in types are supported
			Assert.assertEquals(int, ClassUtils.resolveName("int"));
			Assert.assertEquals(Object, ClassUtils.resolveName("Object"));		
		}
	}
}